<template lang='pug'>
DataTablePage.table.m-t-0(
  ref="tablePage"
  :resource="resource"
  title="授权代理"
  label="授权代理"
  labelName="agentUserId"
  :toolbar="toolbar"
  :operation="operation"
  :operationWidth="120"
  :createList="createList"
  :updateList="updateList"
  :tableFullList="tableFullList"
  :tableInitList="tableInitList"
  :filterFullList="filterFullList"
  :filterInitList="filterInitList"
  :columns="columns")
</template>

<script>
/**
 * @name 授权列表
 * @author linmn
 */
import DataTablePage from '@/containers/DataTablePage'
import {initColumns} from './columns'
import {toolbarCreate} from '@/containers/DataTablePage/toolbar'
import { operationUpdate, operationDelete } from '@/containers/DataTablePage/operation'
export default {
  name: 'FlowAuth',
  components: {
    DataTablePage
  },
  data () {
    return {
      // 委托
      resource: '/workflow/flowAuth',
      tableInitList: ['serial', 'flowDefineId', 'agentUserId', 'enable', 'authStartTime', 'authEndTime'],
      tableFullList: ['flowDefineId', 'agentUserId', 'enable', 'authStartTime', 'authEndTime'],
      createList: ['flowDefineId', 'agentUserId', 'authStartTime', 'authEndTime', 'enable'],
      updateList: ['flowDefineId', 'agentUserId', 'authStartTime', 'authEndTime', 'enable'],
      filterInitList: [],
      filterFullList: [],
      orderByInit: [{
        name: 'updateTime',
        sort: 'desc'
      }],
      toolbar: [toolbarCreate],
      columns: {
        /* 委托 */
        ...initColumns,
        agentUserId: {
          label: '被委托人',
          relation: 'users',
          render: 'select',
          form: {
            type: 'select',
            live: true,
            rules: [{
              type: 'required',
              message: '请选择被委托人'
            }]
          }
        },
        authStartTime: {
          label: '委托开始时间',
          render: {
            type: 'time',
            dateType: 'YYYY-MM-DD HH:mm'
          },
          form: {
            type: 'date',
            rules: [{
              type: 'required',
              message: '请选择委托开始时间'
            }]
          }
        },
        authEndTime: {
          label: '委托结束时间',
          render: {
            type: 'time',
            dateType: 'YYYY-MM-DD HH:mm'
          },
          form: {
            type: 'date',
            rules: [{
              type: 'required',
              message: '请选择委托结束时间'
            }]
          }
        }
      },
      // 授权操作
      operation: [operationUpdate, operationDelete]
    }
  }
}
</script>

<style lang='sass' scoped>
.table
  margin-top: 0 !important
</style>
